//订单查询
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            servAppraiseManageInfo: {
                appraises: [],
                total: 0,
                records: 1,
                conditions: {
                    servName: '',
                    servId: '',
                    appraiseUserName: '',
                    shopId: vc.getCurrentCommunity().shopId,
                    objType: '2002'
                }
            }
        },
        _initMethod: function () {
            $that._listServAppraises(DEFAULT_PAGE, DEFAULT_ROWS);
        },
        _initEvent: function () {
            vc.on('servAppraiseManage', 'goBack', function (_param) {
                $that.servAppraiseManageInfo.orderDetail = false;
            });
            vc.on('servAppraiseManage', 'list', function () {
                $that._listServAppraises(DEFAULT_PAGE, DEFAULT_ROWS);
            });
            vc.on('pagination', 'page_event', function (_currentPage) {
                $that._listServAppraises(_currentPage, DEFAULT_ROWS);
            });
        },
        methods: {
            _listServAppraises: function (_page, _rows) {
                $that.servAppraiseManageInfo.conditions.page = _page;
                $that.servAppraiseManageInfo.conditions.row = _rows;
                var param = {
                    params: $that.servAppraiseManageInfo.conditions
                };
                param.params.servName = param.params.servName.trim();
                param.params.appraiseUserName = param.params.appraiseUserName.trim();
                param.params.servId = param.params.servId.trim();
                //发送get请求
                vc.http.apiGet('/shopAppraise/queryShopAppraise',
                    param,
                    function (json, res) {
                        var _servAppraiseManageInfo = JSON.parse(json);
                        $that.servAppraiseManageInfo.total = _servAppraiseManageInfo.total;
                        $that.servAppraiseManageInfo.records = _servAppraiseManageInfo.records;
                        $that.servAppraiseManageInfo.appraises = _servAppraiseManageInfo.data;
                        vc.emit('pagination', 'init', {
                            total: $that.servAppraiseManageInfo.records,
                            dataCount: $that.servAppraiseManageInfo.total,
                            currentPage: _page
                        });
                    }, function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            //查询
            _queryOrdersMethod: function () {
                $that._listServAppraises(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            //重置
            _resetOrdersMethod: function () {
                $that.servAppraiseManageInfo.conditions.servName = "";
                $that.servAppraiseManageInfo.conditions.appraiseUserName = "";
                $that.servAppraiseManageInfo.conditions.servId = "";
                $that._listServAppraises(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            _ackAppraise: function (appraise) {
            }
        }
    });
})(window.vc);
